import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created by user on 26.01.14.
 */
public class myThread implements Runnable {
    private List<String> all;
    private boolean flag = true;

    public myThread(List<String> all) {
        this.all = all;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

    @Override
    public void run() {
        while (flag) {

            synchronized (all) {
                all.add(System.currentTimeMillis() + "\n");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }


    }

}

